import { defineStore } from 'pinia'
import { getStorage, setStorage } from '@/utils'

export const useThemeStore = defineStore('theme', {
  state: () => {
    return {
      themeKey: getStorage('theme', true) || 'theme_default'
    }
  },
  actions: {
    // 设置工具
    setTheme(data: any) {
      this.themeKey = data
      setStorage('theme', data, 0)
    },
    getTheme() {
      return this.themeKey
    }
  }
})
